<ww:if test="myObj.myString == 'A'">
Why doesn't this work when myString is equal to A?
</ww:if>
OGNL will interpret 'A' as a char type and not a string. Simple solution - flip the double and single quotes.
<ww:if test='myObj.myString == "A"'>
This works!
</ww:if>
Alternatively, you can escape the double quotes in the String:
<ww:if test="myObj.myString == \"A\"">
This works!
</ww:if>
Old Syntax
<ww:if test="#myObj.myString == 'A'">
Why doesn't this work when myString is equal to A?
</ww:if>
OGNL will interpret 'A' as a char type and not a string. Simple solution - flip the double and single quotes.
<ww:if test='#myObj.myString == "A"'>
This works!
</ww:if>
Alternatively, you can escape the double quotes in the String:
<ww:if test="#myObj.myString == \"A\"">
This works!
</ww:if>
|